package com.xiaoh.dormitoryrepairreportbackend.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 工单表
 */
@TableName(value = "work_order")
@Data
@Schema(description = "工单表")
public class WorkOrder implements Serializable {

    /**
     * 工单ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "工单ID")
    private Long id;

    /**
     * 工单编号(业务ID)
     */
    @TableField(value = "work_order_id")
    @Schema(description = "工单编号(业务ID)")
    private String workOrderId;

    /**
     * 报修人ID
     */
    @TableField(value = "reporter_id")
    @Schema(description = "报修人ID")
    private Long reporterId;

    /**
     * 处理人ID
     */
    @TableField(value = "handler_id")
    @Schema(description = "处理人ID")
    private Long handlerId;

    /**
     * 报修类别ID
     */
    @TableField(value = "category_id")
    @Schema(description = "报修类别ID")
    private Integer categoryId;

    /**
     * 工单标题
     */
    @TableField(value = "title")
    @Schema(description = "工单标题")
    private String title;

    /**
     * 问题描述
     */
    @TableField(value = "description")
    @Schema(description = "问题描述")
    private String description;

    /**
     * 报修地址
     */
    @TableField(value = "location")
    @Schema(description = "报修地址")
    private String location;

    /**
     * 图片凭证(URL数组)
     */
    @TableField(value = "images_url")
    @Schema(description = "图片凭证(URL数组)")
    private String imagesUrl;

    /**
     * 工单状态(1:待处理, 2:处理中, 3:已完成, 4:已评价, 0:已取消)
     */
    @TableField(value = "status")
    @Schema(description = "工单状态(1:待处理, 2:处理中, 3:已完成, 4:已评价, 0:已取消)")
    private Integer status;

    /**
     * 服务评分(1-5星)
     */
    @TableField(value = "rating")
    @Schema(description = "服务评分(1-5星)")
    private Integer rating;

    /**
     * 服务评价
     */
    @TableField(value = "review_comment")
    @Schema(description = "服务评价")
    private String reviewComment;

    /**
     * 创建时间
     */
    @TableField(value = "created_at", fill = FieldFill.INSERT)
    @Schema(description = "创建时间")
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间")
    private LocalDateTime updatedAt;

    /**
     * 逻辑删除(0:未删除, 1:已删除)
     */
    @TableField(value = "is_deleted")
    @TableLogic
    @Schema(description = "逻辑删除(0:未删除, 1:已删除)")
    private Integer isDeleted;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}
